package com.user.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@ToString
@ApiModel(value = "服务器出租参数")
public class ServerChuZuVo {

    @ApiModelProperty(value = "id", name = "id")
    private String id;

    @ApiModelProperty(value = "服务器出租id", name = "serverCZId")
    private String serverCZId;

    @NotBlank(message = "服务器ip不能为空")
    @ApiModelProperty(value = "ip", name = "ip")
    private String ip;

    @NotBlank(message = "账号")
    @ApiModelProperty(value = "账号", name = "user")
    private String user;

    @NotBlank(message = "密码不能为空")
    @ApiModelProperty(value = "密码", name = "password")
    private String password;

    //  @NotBlank(message = "内存")
    @ApiModelProperty(value = "内存单位M", name = "mery")
    private int mery;

    //  @NotBlank(message = "带宽")
    @ApiModelProperty(value = "带宽", name = "daik")
    private int daik;

    @ApiModelProperty(value = "磁盘处理器", name = "disk")
    private int disk;

    @NotBlank(message = "地址不能为空")
    @ApiModelProperty(value = "地址", name = "adress")
    private String address;

    //  @NotBlank(message = "开始时间")
    @ApiModelProperty(value = "开始时间", name = "starTime")
    private Date starTime;

    //   @NotBlank(message = "结束时间")
    @ApiModelProperty(value = "结束时间", name = "endTime")
    private Date endTime;

    //   @NotBlank(message = "预计出租价格")
    @ApiModelProperty(value = "预计出租价格", name = "money")
    private BigDecimal money;

    private String starTimeStr;
    private String endTimeStr;

    public String getStarTimeStr() {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(getStarTime());
    }

    public void setStarTimeStr(String starTimeStr) {
        this.starTimeStr = starTimeStr;
    }

    public String getEndTimeStr() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(getEndTime());
    }

    public void setEndTimeStr(String endTimeStr) {
        this.endTimeStr = endTimeStr;
    }
}
